<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/4/6
 * Time: 20:55
 */


require_once "../../config/database.php";
require_once "UserDb.php";
$UserDb=new UserDb();
$sign_width=$_POST['sign_width'];
$user=$_POST['user'];
$sign_height=$_POST['sign_height'];
$selectOne=$_POST['selectOne'];
$title=$_POST['title'];
$title_sum=$_POST['title_sum'];
$height=$_POST['height'];
$price=$_POST['price'];
$img=$_POST['img'];
    $addtime = time();
    $data = $UserDb->add_order($user,$selectOne,$title_sum, $title, $height, $sign_height, $sign_width, $price,$addtime);
    session_start();
    $_SESSION['user'] = $user;
    try {
        $result = $data;
        if ($result) {
            $dat = array(
                'message' => "恭喜您！下单成功"
            );
            echo json_encode($dat);

        } else {
          echo "下单失败";
        }
    } catch (Exception $e) {
        // 回滚事务
        // $pdo->rollback();
        echo $e->getMessage();

    }
